package com.danbay.cloud.device.api.service.electricmeter;

import com.danbay.cloud.device.api.dto.electricmeter.EmConsumptionBetweenDto;
import com.danbay.cloud.device.api.dto.electricmeter.EmConsumptionAddDto;
import com.danbay.cloud.device.api.dto.electricmeter.EmConsumptionDto;
import com.danbay.framework.exception.BusinessException;
import com.danbay.framework.springnc.annotation.AutoController;
import com.danbay.framework.springnc.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestBody;

@AutoController
@RequestMapping("/device-service/em-consumption")
public interface IEmConsumptionService {

    /**
     * 保存一条数据，如果存在，则忽略
     *
     * @param ecaDto
     * @return
     */
    @RequestMapping("/add")
    Integer insert(@RequestBody EmConsumptionAddDto ecaDto);

    /**
     * 根据deviceId和开始结束时间获取用电明细（返回的数据以小时计）
     *
     * @param consumptionQueryDto
     * @return
     */
    @RequestMapping("/get")
    EmConsumptionDto getConsumption(@RequestBody EmConsumptionBetweenDto consumptionQueryDto) throws BusinessException;


    /**
     * 获取某个时间段的用电量
     *
     * @param consumptionQueryDto
     * @return
     */
    @RequestMapping("/get-between")
    Double getConsumptionBetween(@RequestBody EmConsumptionBetweenDto consumptionQueryDto);
}
